<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>用户信息管理</title>
    <#include "../common/link.ftl">
    <script>
        $(function () {
            // 简介查看
            $(".lookBtn1").click(function () {
                var id = $(this).data('id');
                // 根据id查询简介
                $.get('/association/getSynopsisById',{id:id},function (data) {
                    //数据复原
                    $("#editForm").clearForm(true);

                    var synopsis = data.data;
                    if(synopsis){
                        $("textarea[name='synopsis']").val(synopsis);
                    }
                    $("#inputSynModal").modal('show');
                })
            })

            // 详细内容查看
            $(".lookBtn2").click(function () {
                var id = $(this).data('id');
                // 根据id查看详细内容
                $.get('/association/getRemarksById',{id:id},function (data) {
                    $("#inputModal .modal-body").html(data.data);
                    $("#inputModal").modal('show');
                })
            });

            // 申请加入社团
            $(".btn_play").click(function () {
                var id = $(this).data('id');  // 社团id
                var hot = $(this).data('hot');
                $.get("/association/apply", {hot:hot, id:id}, function (data) {
                    if(data.code == 200){
                        window.location.reload();
                    }else{
                        $.messager.alert("温馨提示", data.msg);
                    }
                })
            });
        })
    </script>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <#include "../common/navbarMember.ftl">
    <!--菜单回显-->
    <#assign currentMenu="addassociation"/>
    <#include "../common/menuMember.ftl">
    <div class="content-wrapper">
        <section class="content-header">
            <h1>加入社团</h1>
        </section>
        <section class="content">
            <div class="box">
                <!--高级查询--->
                <div style="margin: 10px;">
                    <form class="form-inline" id="searchForm" action="/association/addassociation.do" method="post">
                        <input type="hidden" name="currentPage" id="currentPage" value="1">
                        <div class="form-group">
                            <label for="keyword">关键字:</label>
                            <input type="text" class="form-control" id="keyword" name="keyword" value="${qo.keyword!}" placeholder="请输入社团/邮箱/负责人">
                        </div>
                        <button id="btn_query" class="btn btn-primary"><span class="glyphicon glyphicon-search"></span> 查询</button>
                    </form>
                </div>
                <table class="table table-hover table-bordered">
                    <thead>
                    <tr>
                        <th>序号</th>
                        <th>图片</th>
                        <th>社团名称</th>
                        <th>创始人</th>
                        <th>性质</th>
                        <th>成立时间</th>
                        <th>人数</th>
                        <th>邮箱</th>
                        <th>社团负责人</th>
                        <th>简介</th>
                        <th>备注</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <#list page.list as association>
                        <tr>
                            <td>${association_index+1}</td>
                            <td><img src="${(association.imgUrl)!'/images/default.jpg'}" width="50px" id="imgUrl"></td>
                            <td>${(association.username)!}</td>
                            <td>${(association.founder)!}</td>
                            <td>${(association.charact)!}</td>
                            <td>${(association.foundTime?string("yyyy-MM-dd"))!}</td>
                            <td>${(association.person)!}</td>
                            <td>${(association.email)!}</td>
                            <td>${association.dutyName!}</td>
                            <td>
                                <a class="btn btn-info btn-xs lookBtn1" href="JavaScript:;" data-id="${association.id}">
                                     查看简介
                                </a>
                            </td>
                            <td>
                                <a class="btn btn-info btn-xs lookBtn2" href="JavaScript:;" data-id="${association.id}">
                                     详细内容
                                </a>
                            </td>
                            <td>
                                <#if ((association.isAdd)!) == 0>
                                    <a href="javascript:;" class="btn btn-primary btn-xs">
                                        <span class="glyphicon glyphicon-time"></span> 申请中
                                    </a>
                                <#elseif ((association.isAdd)!) == 1>
                                    <a href="javascript:;" class="btn btn-success btn-xs">
                                        <span class="glyphicon glyphicon-ok"></span> 已加入
                                    </a>
                                <#else>
                                    <a href="javascript:;" class="btn btn-info btn-xs btn_play" data-hot='0' data-id="${association.id}">
                                        <span class="glyphicon glyphicon-plus"></span> 加入社团
                                    </a>
                                </#if>
                            </td>
                        </tr>
                    </#list>
                </table>
                <!--分页-->
                <#include "../common/page.ftl">
            </div>
        </section>
    </div>
    <#include "../common/footer.ftl">
</div>

<!-- 大图显示 -->
<div id="ShowImage_Form" class="modal fade" >
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-body" >
            </div>
        </div>
    </div>
</div>

<script>
    $("table img").click(function(){
        var src = $(this).attr("src");
        $("#ShowImage_Form .modal-body").html("<img src='"+src+"' class='carousel-inner img-responsive img-rounded' />");
        $("#ShowImage_Form").modal('show');
    })
</script>

<!-- Modal模态框 -->
<div class="modal fade" id="inputSynModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalSynLabel">查看简介</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" action="" method="post" id="editForm">
                    <div class="form-group">
                        <div class="col-sm-12">
                            <textarea rows="15" style="min-width: 100%" name="synopsis"></textarea>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<div class="modal fade" id="inputModal" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" id="myModalLabel">详细内容</h4>
            </div>
            <div class="modal-body" >

            </div>
        </div>
    </div>
</div>

<style>
    #inputModal img{
        width: 570px !important;
    }
</style>

</body>
</html>
